home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_emacs.idb / usr / freeware / info / forms.z / forms
Encoding:
GNU Info File  |  1998-10-28  |  32.0 KB  |  845 lines

  1. This is Info file ../info/forms, produced by Makeinfo-1.64 from the
  2. input file forms.texi.
  3.  
  4.    This file documents Forms mode, a form-editing major mode for GNU
  5. Emacs.
  6.  
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.  
  11. 
  12. File: forms,  Node: Top,  Next: Forms Example,  Up: (dir)
  13.  
  14. Forms Mode
  15. **********
  16.  
  17.    Forms mode is an Emacs major mode for working with simple textual
  18. data bases in a forms-oriented manner.  In Forms mode, the information
  19. in these files is presented in an Emacs window in a user-defined format,
  20. one record at a time.  The user can view records or modify their
  21. contents.
  22.  
  23.    Forms mode is not a simple major mode, but requires two files to do
  24. its job: a control file and a data file.  The data file holds the
  25. actual data to be presented.  The control file describes how to present
  26. it.
  27.  
  28. * Menu:
  29.  
  30. * Forms Example::               An example: editing the password data base.
  31. * Entering and Exiting Forms Mode::
  32.                                 How to visit a file in Forms mode.
  33. * Forms Commands::              Special commands to use while in Forms mode.
  34. * Data File Format::            How to format the data file.
  35. * Control File Format::         How to control forms mode.
  36. * Format Description::          How to define the forms layout.
  37. * Modifying Forms Contents::    How to modify.
  38. * Miscellaneous::               Forms mode messages and other remarks.
  39. * Error Messages::              List of error messages forms mode can produce.
  40. * Long Example::                A more complex control file example.
  41. * Credits::                     Thanks everyone.
  42. * Index::                       Index to this manual.
  43.  
  44. 
  45. File: forms,  Node: Forms Example,  Next: Entering and Exiting Forms Mode,  Prev: Top,  Up: Top
  46.  
  47. Forms Example
  48. *************
  49.  
  50.    Let's illustrate Forms mode with an example.  Suppose you are
  51. looking at the `/etc/passwd' file, and the screen looks like this:
  52.  
  53.      ====== /etc/passwd ======
  54.      
  55.      User : root   Uid: 0   Gid: 1
  56.      
  57.      Name : Super User
  58.      
  59.      Home : /
  60.      
  61.      Shell: /bin/sh
  62.  
  63.    As you can see, the familiar fields from the entry for the super user
  64. are all there, but instead of being colon-separated on one single line,
  65. they make up a forms.
  66.  
  67.    The contents of the forms consist of the contents of the fields of
  68. the record (e.g. `root', `0', `1', `Super User') interspersed with
  69. normal text (e.g `User : ', `Uid: ').
  70.  
  71.    If you modify the contents of the fields, Forms mode will analyze
  72. your changes and update the file appropriately.  You cannot modify the
  73. interspersed explanatory text (unless you go to some trouble about it),
  74. because that is marked read-only (*note Text Properties: (elisp)Text
  75. Properties.).
  76.  
  77.    The Forms mode control file specifies the relationship between the
  78. format of `/etc/passwd' and what appears on the screen in Forms mode.
  79. *Note Control File Format::.
  80.  
  81. 
  82. File: forms,  Node: Entering and Exiting Forms Mode,  Next: Forms Commands,  Prev: Forms Example,  Up: Top
  83.  
  84. Entering and Exiting Forms Mode
  85. *******************************
  86.  
  87. `M-x forms-find-file RET CONTROL-FILE RET'
  88.      Visit a database using Forms mode.  Specify the name of the
  89.      *control file*, not the data file!
  90.  
  91. `M-x forms-find-file-other-window RET CONTROL-FILE RET'
  92.      Similar, but displays the file in another window.
  93.  
  94.    The command `forms-find-file' evaluates the file CONTROL-FILE, and
  95. also visits it in Forms mode.  What you see in its buffer is not the
  96. contents of this file, but rather a single record of the corresponding
  97. data file that is visited in its own buffer.  So there are two buffers
  98. involved in Forms mode: the "forms buffer" that is initially used to
  99. visit the control file and that shows the records being browsed, and
  100. the "data buffer" that holds the data file being visited.  The latter
  101. buffer is normally not visible.
  102.  
  103.    Initially, the first record is displayed in the forms buffer.  The
  104. mode line displays the major mode name `Forms', followed by the minor
  105. mode `View' if the data base is read-only.  The number of the current
  106. record (N) and the total number of records in the file(T) are shown in
  107. the mode line as `N/T'.  For example:
  108.  
  109.      --%%-Emacs: passwd-demo          (Forms View 1/54)----All-------
  110.  
  111.    If the buffer is not read-only, you may change the buffer to modify
  112. the fields in the record.  When you move to a different record, the
  113. contents of the buffer are parsed using the specifications in
  114. `forms-format-list', and the data file is updated.  If the record has
  115. fields that aren't included in the display, they are not changed.
  116.  
  117.    Entering Forms mode runs the normal hook `forms-mode-hooks' to
  118. perform user-defined customization.
  119.  
  120.    To save any modified data, you can use `C-x C-s'
  121. (`forms-save-buffer').  This does not save the forms buffer (which would
  122. be rather useless), but instead saves the buffer visiting the data file.
  123.  
  124.    To terminate Forms mode, you can use `C-x C-s' (`forms-save-buffer')
  125. and then kill the forms buffer.  However, the data buffer will still
  126. remain.  If this is not desired, you have to kill this buffer too.
  127.  
  128. 
  129. File: forms,  Node: Forms Commands,  Next: Data File Format,  Prev: Entering and Exiting Forms Mode,  Up: Top
  130.  
  131. Forms Commands
  132. **************
  133.  
  134.    The commands of Forms mode belong to the `C-c' prefix, with one
  135. exception: TAB, which moves to the next field.  Forms mode uses
  136. different key maps for normal mode and read-only mode.  In read-only
  137. Forms mode, you can access most of the commands without the `C-c'
  138. prefix, but you must type ordinary letters instead of control
  139. characters; for example, type `n' instead of `C-c C-n'.
  140.  
  141.    If your Emacs has been built with X-toolkit support, Forms mode will
  142. provide its own menu with a number of Forms mode commands.
  143.  
  144. `C-c C-n'
  145.      Show the next record (`forms-next-record').  With a numeric
  146.      argument N, show the Nth next record.
  147.  
  148. `C-c C-p'
  149.      Show the previous record (`forms-prev-record').  With a numeric
  150.      argument N, show the Nth previous record.
  151.  
  152. `C-c C-l'
  153.      Jump to a record by number (`forms-jump-record').   Specify the
  154.      record number with a numeric argument.
  155.  
  156. `C-c <'
  157.      Jump to the first record (`forms-first-record').
  158.  
  159. `C-c >'
  160.      Jump to the last record (`forms-last-record').  This command also
  161.      recalculates the number of records in the data file.
  162.  
  163. `TAB'
  164. `C-c TAB'
  165.      Jump to the next field in the current record (`forms-next-field').
  166.      With a numeric argument N, jump forward N fields.  If this command
  167.      would move past the last field, it wraps around to the first field.
  168.  
  169. `C-c C-q'
  170.      Toggles read-only mode (`forms-toggle-read-only').  In read-only
  171.      Forms mode, you cannot edit the fields; most Forms mode commands
  172.      can be accessed without the prefix `C-c' if you use the normal
  173.      letter instead (for example, type `n' instead of `C-c C-n').  In
  174.      edit mode, you can edit the fields and thus change the contents of
  175.      the data base; you must begin Forms mode commands with `C-c'.
  176.      Switching to edit mode is allowed only if you have write access to
  177.      the data file.
  178.  
  179. `C-c C-o'
  180.      Create a new record and insert it before the current record
  181.      (`forms-insert-record').  It starts out with empty (or default)
  182.      contents for its fields; you can then edit the fields.  With a
  183.      numeric argument, the new record is created *after* the current
  184.      one.  See also `forms-modified-record-filter' in *Note Modifying
  185.      Forms Contents::.
  186.  
  187. `C-c C-k'
  188.      Delete the current record (`forms-delete-record').  You are
  189.      prompted for confirmation before the record is deleted unless a
  190.      numeric argument has been provided.
  191.  
  192. `C-c C-s REGEXP RET'
  193.      Search forward for REGEXP in all records following this one
  194.      (`forms-search-forward').  If found, this record is shown.  If you
  195.      give an empty argument, the previous regexp is used again.
  196.  
  197. `C-c C-r REGEXP RET'
  198.      Search backward for REGEXP in all records following this one
  199.      (`forms-search-backward').  If found, this record is shown.  If
  200.      you give an empty argument, the previous regexp is used again.
  201.  
  202. `M-x forms-prev-field'
  203.      Similar to `forms-next-field' but moves backwards.
  204.  
  205. `M-x forms-save-buffer'
  206. `C-x C-s'
  207.      Forms mode replacement for `save-buffer'. When executed in the
  208.      forms buffer it will save the contents of the (modified) data
  209.      buffer instead. In Forms mode this function will be bound to `C-x
  210.      C-s'.
  211.  
  212. `M-x forms-print'
  213.      This command can be used to make a formatted print of the contents
  214.      of the data file.
  215.  
  216.    In addition the command `M-x revert-buffer' is useful in Forms mode
  217. just as in other modes.
  218.  
  219.    The following function key definitions are set up in Forms mode
  220. (whether read-only or not):
  221.  
  222. `next'
  223.      forms-next-record
  224.  
  225. `prior'
  226.      forms-prev-record
  227.  
  228. `begin'
  229.      forms-first-record
  230.  
  231. `end'
  232.      forms-last-record
  233.  
  234. `S-Tab'
  235.      forms-prev-field
  236.  
  237. 
  238. File: forms,  Node: Data File Format,  Next: Control File Format,  Prev: Forms Commands,  Up: Top
  239.  
  240. Data File Format
  241. ****************
  242.  
  243.    Files for use with Forms mode are very simple--each "record"
  244. (usually one line) forms the contents of one form.  Each record consists
  245. of a number of "fields", which are separated by the value of the string
  246. `forms-field-sep', which is `"\t"' (a Tab) by default.
  247.  
  248.    If the format of the data file is not suitable enough you can define
  249. the filter functions `forms-read-file-filter' and
  250. `forms-write-file-filter'. `forms-read-file-filter' is called when the
  251. data file is read from disk into the data buffer. It operates on the
  252. data buffer, ignoring read-only protections. When the data file is
  253. saved to disk `forms-write-file-filter' is called to cancel the effects
  254. of `forms-read-file-filter'. After being saved,
  255. `forms-read-file-filter' is called again to prepare the data buffer for
  256. further processing.
  257.  
  258.    Fields may contain text which shows up in the forms in multiple
  259. lines.  These lines are separated in the field using a "pseudo-newline"
  260. character which is defined by the value of the string
  261. `forms-multi-line'.  Its default value is `"\^k"' (a Control-K
  262. character).  If it is set to `nil', multiple line fields are prohibited.
  263.  
  264.    If the data file does not exist, it is automatically created.
  265.  
  266. 
  267. File: forms,  Node: Control File Format,  Next: Format Description,  Prev: Data File Format,  Up: Top
  268.  
  269. Control File Format
  270. *******************
  271.  
  272.    The Forms mode "control file" serves two purposes.  First, it names
  273. the data file to use, and defines its format and properties.  Second,
  274. the Emacs buffer it occupies is used by Forms mode to display the forms.
  275.  
  276.    The contents of the control file are evaluated as a Lisp program.  It
  277. should set the following Lisp variables to suitable values:
  278.  
  279. `forms-file'
  280.      This variable specifies the name of the data file.  Example:
  281.  
  282.           (setq forms-file "my/data-file")
  283.  
  284.      If the control file doesn't set `forms-file', Forms mode reports
  285.      an error.
  286.  
  287. `forms-format-list'
  288.      This variable describes the way the fields of the record are
  289.      formatted on the screen.  For details, see *Note Format
  290.      Description::.
  291.  
  292. `forms-number-of-fields'
  293.      This variable holds the number of fields in each record of the data
  294.      file.  Example:
  295.  
  296.           (setq forms-number-of-fields 10)
  297.  
  298.    If the control file does not set `forms-format-list' a default
  299. format is used.  In this situation, Forms mode will deduce the number of
  300. fields from the data file providing this file exists and
  301. `forms-number-of-records' has not been set in the control file.
  302.  
  303.    The control file can optionally set the following additional Forms
  304. mode variables.  Most of them have default values that are good for most
  305. applications.
  306.  
  307. `forms-field-sep'
  308.      This variable may be used to designate the string which separates
  309.      the fields in the records of the data file.  If not set, it
  310.      defaults to the string `"\t"' (a Tab character).  Example:
  311.  
  312.           (setq forms-field-sep "\t")
  313.  
  314. `forms-read-only'
  315.      If the value is non-`nil', the data file is treated read-only.
  316.      (Forms mode also treats the data file as read-only if you don't
  317.      have access to write it.)  Example:
  318.  
  319.           (set forms-read-only t)
  320.  
  321. `forms-multi-line'
  322.      This variable specifies the "pseudo newline" separator that allows
  323.      multi-line fields.  This separator goes between the "lines" within
  324.      a field--thus, the field doesn't really contain multiple lines,
  325.      but it appears that way when displayed in Forms mode.  If the
  326.      value is `nil', multi-line text fields are prohibited.  The pseudo
  327.      newline must not be a character contained in `forms-field-sep'.
  328.  
  329.      The default value is `"\^k"', the character Control-K.  Example:
  330.  
  331.           (setq forms-multi-line "\^k")
  332.  
  333. `forms-read-file-filter'
  334.      This variable holds the name of a function to be called after the
  335.      data file has been read in. This can be used to transform the
  336.      contents of the data file into a format more suitable for forms
  337.      processing.  If it is `nil', no function is called.
  338.  
  339. `forms-write-file-filter'
  340.      This variable holds the name of a function to be called before
  341.      writing out the contents of the data file.  This can be used to
  342.      undo the effects of `forms-read-file-filter'.  If it is `nil', no
  343.      function is called.
  344.  
  345. `forms-new-record-filter'
  346.      This variable holds a function to be called whenever a new record
  347.      is created to supply default values for fields.  If it is `nil',
  348.      no function is called.  *Note Modifying Forms Contents::, for
  349.      details.
  350.  
  351. `forms-modified-record-filter'
  352.      This variable holds a function to be called whenever a record is
  353.      modified, just before updating the Forms data file.  If it is
  354.      `nil', no function is called.  *Note Modifying Forms Contents::,
  355.      for details.
  356.  
  357. `forms-insert-after'
  358.      If this variable is not `nil', new records are created *after* the
  359.      current record. Also, upon visiting a file, the initial position
  360.      will be at the last record instead of the first one.
  361.  
  362. `forms-check-number-of-fields'
  363.      Normally each record is checked to contain the correct number of
  364.      fields.  Under certain circumstances, this can be undesirable.  If
  365.      this variable is set to `nil', these checks will be bypassed.
  366.  
  367. 
  368. File: forms,  Node: Format Description,  Next: Modifying Forms Contents,  Prev: Control File Format,  Up: Top
  369.  
  370. The Format Description
  371. **********************
  372.  
  373.    The variable `forms-format-list' specifies the format of the data in
  374. the data file, and how to convert the data for display in Forms mode.
  375. Its value must be a list of Forms mode "formatting elements", each of
  376. which can be a string, a number, a Lisp list, or a Lisp symbol that
  377. evaluates to one of those.  The formatting elements are processed in the
  378. order they appear in the list.
  379.  
  380. STRING
  381.      A string formatting element is inserted in the forms "as is," as
  382.      text that the user cannot alter.
  383.  
  384. NUMBER
  385.      A number element selects a field of the record.  The contents of
  386.      this field are inserted in the display at this point.  Field
  387.      numbers count starting from 1 (one).
  388.  
  389. LIST
  390.      A formatting element that is a list specifies a function call.
  391.      This function is called every time a record is displayed, and its
  392.      result, which must be a string, is inserted in the display text.
  393.      The function should do nothing but returning a string.
  394.  
  395.      The function you call can access the fields of the record as a
  396.      list in the variable `forms-fields'.
  397.  
  398. SYMBOL
  399.      A symbol used as a formatting element should evaluate to a string,
  400.      number, or list; the value is interpreted as a formatting element,
  401.      as described above.
  402.  
  403.    If a record does not contain the number of fields as specified in
  404. `forms-number-of-fields', a warning message will be printed.  Excess
  405. fields are ignored, missing fields are set to empty.
  406.  
  407.    The control file which displays `/etc/passwd' file as demonstrated
  408. in the beginning of this manual might look as follows:
  409.  
  410.      ;; This demo visits `/etc/passwd'.
  411.      
  412.      (setq forms-file "/etc/passwd")
  413.      (setq forms-number-of-fields 7)
  414.      (setq forms-read-only t)                 ; to make sure
  415.      (setq forms-field-sep ":")
  416.      ;; Don't allow multi-line fields.
  417.      (setq forms-multi-line nil)
  418.      
  419.      (setq forms-format-list
  420.            (list
  421.             "====== /etc/passwd ======\n\n"
  422.             "User : "    1
  423.             "   Uid: "   3
  424.             "   Gid: "   4
  425.             "\n\n"
  426.             "Name : "    5
  427.             "\n\n"
  428.             "Home : "    6
  429.             "\n\n"
  430.             "Shell: "    7
  431.             "\n"))
  432.  
  433.    When you construct the value of  `forms-format-list', you should
  434. usually either quote the whole value, like this,
  435.  
  436.      (setq forms-format-list
  437.           '(
  438.             "====== " forms-file " ======\n\n"
  439.             "User : "    1
  440.             (make-string 20 ?-)
  441.             ...
  442.            ))
  443.  
  444. or quote the elements which are lists, like this:
  445.  
  446.      (setq forms-format-list
  447.            (list
  448.             "====== " forms-file " ======\n\n"
  449.             "User : "    1
  450.             '(make-string 20 ?-)
  451.             ...
  452.            ))
  453.  
  454.    Forms mode validates the contents of `forms-format-list' when you
  455. visit a database.  If there are errors, processing is aborted with an
  456. error message which includes a descriptive text.  *Note Error
  457. Messages::, for a detailed list of error messages.
  458.  
  459.    If no `forms-format-list' is specified, Forms mode will supply a
  460. default format list.  This list contains the name of the file being
  461. visited, and a simple label for each field indicating the field number.
  462.  
  463. 
  464. File: forms,  Node: Modifying Forms Contents,  Next: Miscellaneous,  Prev: Format Description,  Up: Top
  465.  
  466. Modifying The Forms Contents
  467. ****************************
  468.  
  469.    If `forms-read-only' is `nil', the user can modify the fields and
  470. records of the database.
  471.  
  472.    All normal editing commands are available for editing the contents
  473. of the displayed record.  You cannot delete or modify the fixed,
  474. explanatory text that comes from string formatting elements, but you
  475. can modify the actual field contents.
  476.  
  477.    If the variable `forms-modified-record-filter' is non-`nil', it is
  478. called as a function before the new data is written to the data file.
  479. The function receives one argument, a vector that contains the contents
  480. of the fields of the record.
  481.  
  482.    The function can refer to fields with `aref' and modify them with
  483. `aset'.  The first field has number 1 (one); thus, element 0 of the
  484. vector is not used.  The function should return the same vector it was
  485. passed; the (possibly modified) contents of the vector determine what is
  486. actually written in the file.  Here is an example:
  487.  
  488.      (defun my-modified-record-filter (record)
  489.        ;; Modify second field.
  490.        (aset record 2 (current-time-string))
  491.        ;; Return the field vector.
  492.        record)
  493.      
  494.      (setq forms-modified-record-filter 'my-modified-record-filter)
  495.  
  496.    If the variable `forms-new-record-filter' is non-`nil', its value is
  497. a function to be called to fill in default values for the fields of a
  498. new record.  The function is passed a vector of empty strings, one for
  499. each field; it should return the same vector, with the desired field
  500. values stored in it.  Fields are numbered starting from 1 (one).
  501. Example:
  502.  
  503.      (defun my-new-record-filter (fields)
  504.        (aset fields 5 (login-name))
  505.        (aset fields 1 (current-time-string))
  506.        fields)
  507.      
  508.      (setq forms-new-record-filter 'my-new-record-filter)
  509.  
  510. 
  511. File: forms,  Node: Miscellaneous,  Next: Error Messages,  Prev: Modifying Forms Contents,  Up: Top
  512.  
  513. Miscellaneous
  514. *************
  515.  
  516.    The global variable `forms-version' holds the version information of
  517. the Forms mode software.
  518.  
  519.    It is very convenient to use symbolic names for the fields in a
  520. record.  The function `forms-enumerate' provides an elegant means to
  521. define a series of variables whose values are consecutive integers.  The
  522. function returns the highest number used, so it can be used to set
  523. `forms-number-of-fields' also.  For example:
  524.  
  525.      (setq forms-number-of-fields
  526.            (forms-enumerate
  527.             '(field1 field2 field3 ...)))
  528.  
  529.    This sets `field1' to 1, `field2' to 2, and so on.
  530.  
  531.    Care has been taken to keep the Forms mode variables buffer-local,
  532. so it is possible to visit multiple files in Forms mode simultaneously,
  533. even if they have different properties.
  534.  
  535.    If you have visited the control file in normal fashion with
  536. `find-file' or a like command, you can switch to Forms mode with the
  537. command `M-x forms-mode'.  If you put `-*- forms -*-' in the first line
  538. of the control file, then visiting it enables Forms mode automatically.
  539. But this makes it hard to edit the control file itself, so you'd
  540. better think twice before using this.
  541.  
  542.    The default format for the data file, using `"\t"' to separate
  543. fields and `"\^k"' to separate lines within a field, matches the file
  544. format of some popular database programs, e.g. FileMaker.  So
  545. `forms-mode' can decrease the need to use proprietary software.
  546.  
  547. 
  548. File: forms,  Node: Error Messages,  Next: Long Example,  Prev: Miscellaneous,  Up: Top
  549.  
  550. Error Messages
  551. **************
  552.  
  553.    This section describes all error messages which can be generated by
  554. forms mode.  Error messages that result from parsing the control file
  555. all start with the text `Forms control file error'.  Messages generated
  556. while analyzing the definition of `forms-format-list' start with `Forms
  557. format error'.
  558.  
  559. `Forms control file error: 'forms-file' has not been set'
  560.      The variable `forms-file' was not set by the control file.
  561.  
  562. `Forms control file error: 'forms-number-of-fields' has not been set'
  563.      The variable `forms-number-of-fields' was not set by the control
  564.      file.
  565.  
  566. `Forms control file error: 'forms-number-of-fields' must be a number > 0'
  567.      The variable `forms-number-of-fields' did not contain a positive
  568.      number.
  569.  
  570. `Forms control file error: 'forms-field-sep' is not a string'
  571. `Forms control file error: 'forms-multi-line' must be nil or a one-character string'
  572.      The variable `forms-multi-line' was set to something other than
  573.      `nil' or a single-character string.
  574.  
  575. `Forms control file error: 'forms-multi-line' is equal to 'forms-field-sep''
  576.      The variable `forms-multi-line' may not be equal to
  577.      `forms-field-sep' for this would make it impossible to distinguish
  578.      fields and the lines in the fields.
  579.  
  580. `Forms control file error: 'forms-new-record-filter' is not a function'
  581. `Forms control file error: 'forms-modified-record-filter' is not a function'
  582.      The variable has been set to something else than a function.
  583.  
  584. `Forms control file error: 'forms-format-list' is not a list'
  585.      The variable `forms-format-list' was not set to a Lisp list by the
  586.      control file.
  587.  
  588. `Forms format error: field number XX out of range 1..NN'
  589.      A field number was supplied in `forms-format-list' with a value of
  590.      XX, which was not greater than zero and smaller than or equal to
  591.      the number of fields in the forms, NN.
  592.  
  593. `Forms format error:  not a function FUN'
  594.      The first element of a list which is an element of
  595.      `forms-format-list' was not a valid Lisp function.
  596.  
  597. `Forms format error:  invalid element XX'
  598.      A list element was supplied in `forms-format-list' which was not a
  599.      string, number or list.
  600.  
  601. `Warning: this record has XX fields instead of YY'
  602.      The number of fields in this record in the data file did not match
  603.      `forms-number-of-fields'.  Missing fields will be made empty.
  604.  
  605. `Multi-line fields in this record - update refused!'
  606.      The current record contains newline characters, hence can not be
  607.      written back to the data file, for it would corrupt it.  Probably
  608.      you inserted a newline in a field, while `forms-multi-line' was
  609.      `nil'.
  610.  
  611. `Field separator occurs in record - update refused!'
  612.      The current record contains the field separator string inside one
  613.      of the fields. It can not be written back to the data file, for it
  614.      would corrupt it. Probably you inserted the field separator string
  615.      in a field.
  616.  
  617. `Record number XX out of range 1..YY'
  618.      A jump was made to non-existing record XX.  YY denotes the number
  619.      of records in the file.
  620.  
  621. `Stuck at record XX'
  622.      An internal error prevented a specific record from being retrieved.
  623.  
  624. `No write access to `"'FILE`"''
  625.      An attempt was made to enable edit mode on a file that has been
  626.      write protected.
  627.  
  628. ``"'REGEXP`"' not found'
  629.      The REGEXP could not be found in the data file, starting at the
  630.      current record location.
  631.  
  632. `Warning: number of records changed to NN'
  633.      Forms mode's idea of the number of records has been adjusted to the
  634.      number of records actually present in the data file.
  635.  
  636. `Problem saving buffers?'
  637.      An error occurred while saving the data file buffer. Most likely,
  638.      Emacs did ask to confirm deleting the buffer because it had been
  639.      modified, and you said `no'.
  640.  
  641. 
  642. File: forms,  Node: Long Example,  Next: Credits,  Prev: Error Messages,  Up: Top
  643.  
  644. Long Example
  645. ************
  646.  
  647.    The following example exploits most of the features of Forms mode.
  648. This example is included in the distribution as file `forms-d2.el'.
  649.  
  650.      ;; demo2 -- demo forms-mode    -*- emacs-lisp -*-
  651.      
  652.      ;; SCCS Status     : demo2    1.1.2
  653.      ;; Author          : Johan Vromans
  654.      ;; Created On      : 1989
  655.      ;; Last Modified By: Johan Vromans
  656.      ;; Last Modified On: Mon Jul  1 13:56:31 1991
  657.      ;; Update Count    : 2
  658.      ;; Status          : OK
  659.      ;;
  660.      ;; This sample forms exploit most of the features of forms mode.
  661.      
  662.      ;; Set the name of the data file.
  663.      (setq forms-file "forms-d2.dat")
  664.      
  665.      ;; Use `forms-enumerate' to set field names and number thereof.
  666.      (setq forms-number-of-fields
  667.            (forms-enumerate
  668.             '(arch-newsgroup            ; 1
  669.           arch-volume            ; 2
  670.           arch-issue            ; and ...
  671.           arch-article            ; ... so
  672.           arch-shortname            ; ... ... on
  673.           arch-parts
  674.           arch-from
  675.           arch-longname
  676.           arch-keywords
  677.           arch-date
  678.           arch-remarks)))
  679.      
  680.      ;; The following functions are used by this form for layout purposes.
  681.      ;;
  682.      (defun arch-tocol (target &optional fill)
  683.        "Produces a string to skip to column TARGET.
  684.      Prepends newline if needed.
  685.      The optional FILL should be a character, used to fill to the column."
  686.        (if (null fill)
  687.            (setq fill ? ))
  688.        (if (< target (current-column))
  689.            (concat "\n" (make-string target fill))
  690.          (make-string (- target (current-column)) fill)))
  691.      ;;
  692.      (defun arch-rj (target field &optional fill)
  693.        "Produces a string to skip to column TARGET\
  694.       minus the width of field FIELD.
  695.      Prepends newline if needed.
  696.      The optional FILL should be a character,
  697.      used to fill to the column."
  698.        (arch-tocol (- target (length (nth field forms-fields))) fill))
  699.      
  700.      ;; Record filters.
  701.      ;;
  702.      (defun new-record-filter (the-record)
  703.        "Form a new record with some defaults."
  704.        (aset the-record arch-from (user-full-name))
  705.        (aset the-record arch-date (current-time-string))
  706.        the-record)                ; return it
  707.      (setq forms-new-record-filter 'new-record-filter)
  708.      
  709.      ;; The format list.
  710.      (setq forms-format-list
  711.           (list
  712.             "====== Public Domain Software Archive ======\n\n"
  713.             arch-shortname
  714.             " - "            arch-longname
  715.             "\n\n"
  716.             "Article: "        arch-newsgroup
  717.             "/"            arch-article
  718.             " "
  719.             '(arch-tocol 40)
  720.             "Issue: "        arch-issue
  721.             " "
  722.             '(arch-rj 73 10)
  723.             "Date: "            arch-date
  724.             "\n\n"
  725.             "Submitted by: "        arch-from
  726.             "\n"
  727.             '(arch-tocol 79 ?-)
  728.             "\n"
  729.             "Keywords: "        arch-keywords
  730.             "\n\n"
  731.             "Parts: "        arch-parts
  732.             "\n\n====== Remarks ======\n\n"
  733.             arch-remarks
  734.           ))
  735.      
  736.      ;; That's all, folks!
  737.  
  738. 
  739. File: forms,  Node: Credits,  Next: Index,  Prev: Long Example,  Up: Top
  740.  
  741. Credits
  742. *******
  743.  
  744.    Bug fixes and other useful suggestions were supplied by Harald
  745. Hanche-Olsen (`hanche@imf.unit.no'), `cwitty@portia.stanford.edu',
  746. Jonathan I. Kamens, Per Cederqvist  (`ceder@signum.se'), Michael Lipka
  747. (`lipka@lip.hanse.de'), Andy Piper (`ajp@eng.cam.ac.uk'), Frederic
  748. Pierresteguy  (`F.Pierresteguy@frcl.bull.fr'), Ignatios Souvatzis and
  749. Richard Stallman (`rms@gnu.ai.mit.edu').
  750.  
  751.    This documentation was slightly inspired by the documentation of
  752. "rolo mode" by Paul Davis at Schlumberger Cambridge Research
  753. (`davis%scrsu1%sdr.slb.com@relay.cs.net').
  754.  
  755.    None of this would have been possible without GNU Emacs of the Free
  756. Software Foundation.  Thanks, Richard!
  757.  
  758. 
  759. File: forms,  Node: Index,  Prev: Credits,  Up: Top
  760.  
  761. Index
  762. *****
  763.  
  764. * Menu:
  765.  
  766. * TAB:                                  Forms Commands.
  767. * begin:                                Forms Commands.
  768. * C-c <:                                Forms Commands.
  769. * C-c >:                                Forms Commands.
  770. * C-c TAB:                              Forms Commands.
  771. * C-c C-k:                              Forms Commands.
  772. * C-c C-l:                              Forms Commands.
  773. * C-c C-n:                              Forms Commands.
  774. * C-c C-o:                              Forms Commands.
  775. * C-c C-p:                              Forms Commands.
  776. * C-c C-q:                              Forms Commands.
  777. * C-c C-r REGEXP RET:                   Forms Commands.
  778. * C-c C-s REGEXP RET:                   Forms Commands.
  779. * C-x C-s:                              Forms Commands.
  780. * control file:                         Control File Format.
  781. * end:                                  Forms Commands.
  782. * field:                                Data File Format.
  783. * forms-check-number-of-fields:         Control File Format.
  784. * forms-delete-record:                  Forms Commands.
  785. * forms-enumerate:                      Miscellaneous.
  786. * forms-field-sep <1>:                  Control File Format.
  787. * forms-field-sep:                      Data File Format.
  788. * forms-fields:                         Format Description.
  789. * forms-file:                           Control File Format.
  790. * forms-find-file:                      Entering and Exiting Forms Mode.
  791. * forms-find-file-other-window:         Entering and Exiting Forms Mode.
  792. * forms-first-record:                   Forms Commands.
  793. * forms-format-list <1>:                Control File Format.
  794. * forms-format-list:                    Format Description.
  795. * forms-insert-after:                   Control File Format.
  796. * forms-insert-record:                  Forms Commands.
  797. * forms-jump-record:                    Forms Commands.
  798. * forms-last-record:                    Forms Commands.
  799. * forms-mode:                           Miscellaneous.
  800. * forms-mode-hooks:                     Entering and Exiting Forms Mode.
  801. * forms-modified-record-filter:         Control File Format.
  802. * forms-multi-line <1>:                 Data File Format.
  803. * forms-multi-line:                     Control File Format.
  804. * forms-new-record-filter:              Control File Format.
  805. * forms-next-field:                     Forms Commands.
  806. * forms-next-record:                    Forms Commands.
  807. * forms-number-of-fields:               Control File Format.
  808. * forms-prev-field:                     Forms Commands.
  809. * forms-prev-record:                    Forms Commands.
  810. * forms-print:                          Forms Commands.
  811. * forms-read-file-filter <1>:           Control File Format.
  812. * forms-read-file-filter:               Data File Format.
  813. * forms-read-only:                      Control File Format.
  814. * forms-save-buffer:                    Forms Commands.
  815. * forms-search-backward:                Forms Commands.
  816. * forms-search-forward:                 Forms Commands.
  817. * forms-toggle-read-only:               Forms Commands.
  818. * forms-version:                        Miscellaneous.
  819. * forms-write-file-filter <1>:          Control File Format.
  820. * forms-write-file-filter:              Data File Format.
  821. * next:                                 Forms Commands.
  822. * prior:                                Forms Commands.
  823. * pseudo-newline:                       Data File Format.
  824. * record:                               Data File Format.
  825. * S-Tab:                                Forms Commands.
  826.  
  827.  
  828. 
  829. Tag Table:
  830. Node: Top335
  831. Node: Forms Example1741
  832. Node: Entering and Exiting Forms Mode2960
  833. Node: Forms Commands5158
  834. Node: Data File Format8948
  835. Node: Control File Format10287
  836. Node: Format Description14305
  837. Node: Modifying Forms Contents17647
  838. Node: Miscellaneous19534
  839. Node: Error Messages21072
  840. Node: Long Example24960
  841. Node: Credits28032
  842. Node: Index28792
  843. 
  844. End Tag Table
  845.